class_name PlayerFallState
extends PlayerState

const AIR_SPEED: float = 60
const JUMP_FORCE: float = 20

func enter() -> void:
	super()
	player.velocity.y = JUMP_FORCE
	player.animation_player.play("fall", -1, 2)

func exit(new_state: State = null) -> void:
	super(new_state)
	player.velocity.x = 0

func process_input(event: InputEvent) -> State:
	super(event)
	determine_player_flipped(event)
	return null
		
func process_physics(delta: float) -> State:
	do_move(get_move_dir(), AIR_SPEED)
	
	if player.is_on_floor():
		if get_move_dir() != 0.0:
			return walk_state
		else:
			return idle_state

	return super(delta)
